import java.util.Random;

public class jienigui extends Pokemon{
    private String name="杰尼龟";
    private int HP=150;
    private boolean health=true;
    public void attack(Pokemon p){
        Random random = new Random();
        double result = random.nextDouble();
        if(result<0.6){
            System.out.println(this.name+"使用了【甩尾】");
            p.setHP(p.getHP()-20);
        }else if (result<0.9){
            System.out.println(this.name+"使用了【水枪】");
            p.setHP(p.getHP()-40);
        }else {
            System.out.println(this.name+"使用了【水流喷射】");
            p.setHP(p.getHP()-70);
        }
        if (p.getHP()<=0){
            p.setHealth(false);
            System.out.println(this.name+"击败了"+p.getName());
        }else {
            System.out.println(p.getName()+"的剩余血量为"+p.getHP());
        }
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int getHP() {
        return HP;
    }

    @Override
    public void setHP(int HP) {
        this.HP = HP;
    }

    @Override
    public boolean isHealth() {
        return health;
    }

    @Override
    public void setHealth(boolean health) {
        this.health = health;
    }

    @Override
    public String toString() {
        return "杰尼龟(HP=" + HP +
                ')';
    }
}
